<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<title>业主统计</title>
<jsp:include page="../../views/layout/inc.jsp"></jsp:include>

<script type="text/javascript">
	var dataGrid;
	$(function() {
		dataGrid = $('#dataGrid').datagrid({
			singleSelect : true,
			url : '/owenrStatisticsController/dataGrid',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10, 20, 30, 40, 50 ],
			sortName : 'gmtCreate',
			sortOrder : 'asc',
			checkOnSelect : false,
			selectOnCheck : false,
			nowrap : false,
			columns : [ [ {
				field : 'loginName',
				title : '登录名',
				width : 100,
				sortable : true
			},{
				field : 'name',
				title : '姓名',
				width : 100,
				sortable : true
			},{
				field : 'sex',
				title : '性别',
				width : 100,
				sortable : true,
				formatter:function(val,rec) {
					if(val == 0) {
						return '女';
					}else if(val == 1) {
						return '男';
					}
				}
			},{
				field : 'typeName',
				title : '用户类型',
				width : 100,
				sortable : true
			},{
				field : 'mobile',
				title : '手机号',
				width : 100
			},{
				field : 'status',
				title : '状态',
				width : 100,
				formatter:function(val,rec) {
					if(val == 1) {
						return '正常';
					}else if(val == 2) {
						return '受限';
					}else if(val == 3) {
						return '冻结';
					}else if(val == 4) {
						return '注销';
					}else {
						return '未知';
					}
				}
			},{
				field : 'lastLoginTime',
				title : '最后登录时间',
				width : 100,
				sortable : true,
				formatter:function(val,rec){ 
					 var unixTimestamp = new Date(val);  
                     return unixTimestamp.format('yyyy-MM-dd hh:mm:ss');  
				}
			},{
				field : 'gmtCreate',
				title : '创建时间',
				width : 100,
				sortable : true,
				formatter:function(val,rec){ 
					 var unixTimestamp = new Date(val);  
                     return unixTimestamp.format('yyyy-MM-dd hh:mm:ss');  
				}
			},{
				field : 'gmtModify',
				title : '修改时间',
				width : 100,
				sortable : true,
				formatter:function(val,rec){ 
					 var unixTimestamp = new Date(val);  
                     return unixTimestamp.format('yyyy-MM-dd hh:mm:ss');  
				}
			}] ],
			toolbar : '#toolbar',
			onLoadSuccess : function() {
				$('#searchForm table').show();
				parent.$.messager.progress('close');
				$(this).datagrid('tooltip');
			}
		});
		
		$.ajax({
			type:'post',
			url:'/owenrStatisticsController/getComboData',
			data:{},
			success:function(result) {
				$('#sex').combobox({
					data : result.sex,
					width : 120,
				    panelHeight:'auto',
				    icons : [{
						iconCls : 'icon-clear',
						handler : function(e){
							$(e.data.target).combobox('setValue','');
						}
					}]
				});
				$('#typeId').combobox({
					data : result.type,
					width : 120,
				    panelHeight:'auto',
				    icons : [{
						iconCls : 'icon-clear',
						handler : function(e){
							$(e.data.target).combobox('setValue','');
						}
					}]
				});
				$('#status').combobox({
					data : result.status,
					width : 120,
				    panelHeight:'auto',
				    icons : [{
						iconCls : 'icon-clear',
						handler : function(e){
							$(e.data.target).combobox('setValue','');
						}
					}]
				});
			},
			dataType:'json'
		});
	});

	
	

	function searchFun() {
		dataGrid.datagrid('load', $.serializeObject($('#searchForm')));
	}
	function cleanFun() {
		$('#searchForm input').val('');
		dataGrid.datagrid('load', {});
	}
</script>
</head>
<body>
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',title:'查询条件',border:false" style="height: 220px; overflow: hidden;">
			<form id="searchForm">
				<table class="table table-hover table-condensed" style="display: none;">
					<tr>
						<th>姓名</th>
						<td><input name="name" placeholder="可以模糊查询用户姓名" class="span2" /></td>
					</tr>
					<tr>
						<th>性别</th>
						<td><input id="sex" name="sex" class="span2" /></td>
					</tr>
					<tr>
						<th>用户类型</th>
						<td><input id="typeId" name="typeId" class="span2" /></td>
					</tr>
					<tr>
						<th>状态</th>
						<td><input id="status" name="status" class="span2" /></td>
					</tr>
					<tr>
						<th>最后登录时间</th>
						<td><input name="startLastLoginTime" id="startLastLoginTime" placeholder="点击选择时间" class="Wdate" style="width:150px" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endLastLoginTime\') || \'%y-%M-%d\'}'})"/>
							至<input name="endLastLoginTime" id="endLastLoginTime" placeholder="点击选择时间" class="Wdate" style="width:150px" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startLastLoginTime\') || \'%y-%M-%d\'}'})"/></td>
					</tr>
					<tr>
						<th>创建时间</th>
						<td><input name="startGmtCreate" id="startGmtCreate" placeholder="点击选择时间" class="Wdate" style="width:150px" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endGmtCreate\') || \'%y-%M-%d\'}'})"/>
							至<input name="endGmtCreate" id="endGmtCreate" placeholder="点击选择时间" class="Wdate" style="width:150px" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startGmtCreate\') || \'%y-%M-%d\'}'})"/></td>
					</tr>
					<tr>
						<th>修改时间</th>
						<td><input name="startGmtModify" id="startGmtModify" placeholder="点击选择时间" class="Wdate" style="width:150px" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endGmtModify\') || \'%y-%M-%d\'}'})"/>
							至<input name="endGmtModify" id="endGmtModify" placeholder="点击选择时间" class="Wdate" style="width:150px" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startGmtModify\') || \'%y-%M-%d\'}'})"/></td>
					</tr>
				</table>
			</form>
		</div>
		<div data-options="region:'center',border:false">
			<table id="dataGrid"></table>
		</div>
	</div>
	<div id="toolbar" style="display: none;">
		<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'brick_add',plain:true" onclick="searchFun();">过滤条件</a><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'brick_delete',plain:true" onclick="cleanFun();">清空条件</a>
	</div>
</body>
</html>